package com.ljw.community.mapper;

import com.ljw.community.entity.User;
import com.ljw.community.service.SqlService;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface CommonMapper {

    /**
     * 获取 用户或管理员 的 登录名
     * @param id id
     * @return 登录名
     */
    @Select(value = "select login_name from (select u.login_name login_name,u.id,u.del_flag from user u " +
                    "union all select a.login_name login_name,a.id,a.del_flag from admin a) t " +
                    "where t.id = #{id} and t.del_flag = 0")
    String getLoginNameById(String id);
}
